package com.comp490.sprite;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;

import com.comp490.shooter.GameView;
import com.comp490.shooter.R;

public class BitmapResource
{
    /* Player ship bitmap and variables */
    public static Bitmap PLAYER_SHIP;
    public static float PLAYER_BULLET_CENTER_WIDTH;
    public static float PLAYER_BULLET_CENTER_HEIGHT;

    public static Bitmap PLAYER_BULLET;
    public static Bitmap EXPLOSION;
    public static Bitmap SMALL_ENEMY_SHIP;
    public static Bitmap MEDIUM_ENEMY_SHIP;
    public static Bitmap LARGE_ENEMY_SHIP;
    public static Bitmap LEVEL_ONE_BITMAP_BG;

    public static Paint GAME_INDICATOR;
    public static Paint GAME_SCORE;
    public static Paint RED_PAINT;
    public static Paint HIT_INDICATOR;
    
    public static void loadResources(GameView gameView)
    {
        PLAYER_SHIP = BitmapFactory.decodeResource(gameView.getResources(),
                R.drawable.tiny_ship);
        PLAYER_BULLET = BitmapFactory.decodeResource(gameView.getResources(),
                R.drawable.bullet);
        PLAYER_BULLET_CENTER_WIDTH = PLAYER_BULLET.getWidth() / 2;
        PLAYER_BULLET_CENTER_HEIGHT = PLAYER_BULLET.getHeight() / 2;
        LARGE_ENEMY_SHIP = BitmapFactory.decodeResource(
                gameView.getResources(), R.drawable.large_enemy);
        MEDIUM_ENEMY_SHIP = BitmapFactory.decodeResource(
                gameView.getResources(), R.drawable.medium_enemy);
        SMALL_ENEMY_SHIP = BitmapFactory.decodeResource(
                gameView.getResources(), R.drawable.small_enemy);
        LEVEL_ONE_BITMAP_BG = BitmapFactory.decodeResource(
                gameView.getResources(), R.drawable.background);
        EXPLOSION = BitmapFactory.decodeResource(gameView.getResources(),
                R.drawable.explosions);

        /* Score setup */
        GAME_SCORE = new Paint();
        GAME_SCORE.setTypeface(Typeface.createFromAsset(gameView.getContext()
                .getAssets(), "arkitect_round.ttf"));
        GAME_SCORE.setTextSize(20);
        GAME_SCORE.setColor(Color.WHITE);

        /* Game Info */
        GAME_INDICATOR = new Paint();
        GAME_INDICATOR.setTypeface(Typeface.createFromAsset(gameView
                .getContext().getAssets(), "photonica_regular.ttf"));
        GAME_INDICATOR.setTextSize(24);
        GAME_INDICATOR.setColor(Color.WHITE);

        /* Various Paint Objects */
        RED_PAINT = new Paint();
        RED_PAINT.setColor(Color.RED);

        /* Used to make the enemy flash */
        HIT_INDICATOR = new Paint();
        HIT_INDICATOR.setAlpha(10);
    }
}
